package com.example.cinemaorder.mapper;


import com.example.cinemaorder.entity.vo.SearchMovieInfoVo;
import com.example.cinemaorder.entity.vo.SearchMovieVo;
import com.example.cinemaorder.entity.vo.SysRatingVo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SysMovieMapper {

//   查询电影信息
    Object findMovieById(Long id);

//    按照条件搜索
    List<SearchMovieVo> search(SearchMovieInfoVo searchMovieInfoVo);

//  查询出所有的影厅
    @Select("select distinct hall_category from sys_hall")
    List<String> getHalls();

//    查询出所有的影院
    @Select("select distinct cinema_name from sys_cinema_arrange")
    List<String> getCinemas();

//    查询所有电影的id
    @Select("select movie_id from sys_movie")
    List<Long> getIds();

    @Select("select rating from sys_recomand where bill_id = #{billId}")
    Object getRatingByBill(Long billId);

    @Insert("insert into sys_recomand values (#{movieId},#{userId},#{billId},#{rating})")
    void sendRating(SysRatingVo sysRatingVo);

    @Select("select bill_id from sys_recomand where bill_id = #{billId}")
    SysRatingVo checkSend(SysRatingVo sysRatingVo);
}
